package com.baizhi.service;

import com.baizhi.dao.AlbumDao;
import com.baizhi.entrty.Album;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class AlbumServiceImpl implements AlbumService {
    @Autowired
    private AlbumDao ad;
    @Override
    public Map fy(int page, int rows) {
        int count = ad.getCount();

        int start = (page-1)*rows;

        Map map = new HashMap();
        List<Album> list = ad.getAlbum(start,rows);
        map.put("total",count);
        map.put("rows",list);
        return map;
    }

    @Override
    public void addAlbum(Album album) {
        ad.addAlbum(album);
    }

    @Override
    public void delete(int[] id) {

        ad.delete(id);
    }

    @Override
    public void update(Album al) {

        ad.update(al);
    }

    @Override
    public List<Album> getTree() {
        return ad.getTree();
    }

    @Override
    public List<Album> showAll() {
        return ad.showAll();
    }

    @Override
    public Album showOne(int albumId) {
        return ad.showOne(albumId);
    }

    @Override
    public Album showList(int albumId) {

     return ad.showList(albumId);
    }
}
